import book.BookList;
import user.AdmainUser;
import user.NomarUser;
import user.User;
import java.util.Scanner;

public class Main {
    public static User login() {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入用户昵称：");
        String userName = sc.nextLine();
        System.out.println("1. 管理员登录   2.普通用户登录");
        System.out.println("请输入你的登录方式：");
        int choice = sc.nextInt();
        if (choice == 1) {
            return new AdmainUser(userName);
        } else {
            return new NomarUser(userName);
        }
    }
    public static void main(String[] args) {
        User user = login();
        BookList bookList = new BookList();
        while (true) {
            int choice = user.menu();
            user.doOperation(choice,bookList);
        }
    }
}
